from pygrabber.dshow_graph import FilterGraph

def list_cameras():
    graph = FilterGraph()
    devices = graph.get_input_devices()  # 获取所有视频输入设备
    print("可用的摄像头设备：")
    for i, device in enumerate(devices):
        print(f"{i}: {device}")

if __name__ == "__main__":
    list_cameras()